function functionLike(e , productId){
	var url = baseUrl+ "/game/like";
	$.ajax({ 
	    	url : url,
	    	type: 'POST',
	    	cache : false,
	    	data : {"gameId" : productId},
	    	success:function(html){
	    		console.log(html);
	    	     if(html == "liked"){
	    	        alert("Bạn đã mới like rồi mà :)"); 
	    	     }else{
	    			$(e).find(".number").html( parseInt($(e).find(".number").text())+1);                              
                }
	    	},
	    	error : function (data){ 
	    		console.log(data);
	    	}
	    });
	return false;
}
function functionShare(e , productId){
	var url = baseUrl+ "/game/share";
	$.ajax({ 
	    	url : url,
	    	type: 'POST',
	    	cache : false,
	    	data : {"gameId" : productId},
	    	success:function(html){
	    			$(e).find(".number").html( parseInt($(e).find(".number").text())+1);                              
	    	},
	    	error : function (data){ 
	    		console.log(data);
	    	}
	    });
}
function addDownload(productId){
	var url = baseUrl+ "/game/adddownload";
	$.ajax({ 
	    	url : url,
	    	type: 'POST',
	    	cache : false,
	    	data : {"gameId" : productId},
	    	success: function(html){
	    		$(".download_number").html( parseInt($(".download_number").text())+1);
	    		return true;
	    	},
	    	error : function (data){ 
	    		console.log(data);
	    		return false;
	    	}
	    });

}
function showGameInfo(e){
	if($("#menu-item2").hasClass("active"))
		$("#game_info_content").show();
	else
	$("#game_info_content").slideToggle('slow');
	$(e).toggleClass("active");
	$("#game_help_content").hide();
	$("#menu-item2").removeClass("active");
}
function showGameHelp(e){
	if($("#menu-item1").hasClass("active"))
		$("#game_help_content").show();
	else
	$("#game_help_content").slideToggle('slow');
	
	$(e).toggleClass("active");
	
	$("#game_info_content").hide();
	
	$("#menu-item1").removeClass("active");
}
function login(e){
	e.stopPropagation && e.stopPropagation() || (e.cancelBubble = true);
	
	$("#form_login").slideToggle('slow');
	$(".overlay").toggle();
	return false;
}
function showAcountSettingSelection(e){
	$("#acount_setting_box").slideToggle('slow');
	
	e.stopPropagation(); 
	return false;
}
 $('html').bind('click',function(event) {
        //check up the tree of the click target to check whether user has clicked outside of menu
        if ($(event.target).parents('#acount_setting_box').length==0) {
        	$("#acount_setting_box").hide();
        }

 });